<template>
  <el-dialog
    :visible.sync="visible"
    title="详情"
    top="30px"
    append-to-body
    :close-on-click-modal="false"
    :before-close="beforeClose"
  >
    <div v-loading="loading">
      <div class="dl-wrap">
        <div class="dl-dt">产品名</div>
        <div class="dl-dd">{{ goodsData.load_name }}</div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">产品类型</div>
        <div class="dl-dd">{{ enumProductType[goodsData.product_type] }}</div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">反担保方式</div>
        <div class="dl-dd">{{ goodsData.gua_method_name }}</div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">支持产业</div>
        <div class="dl-dd">{{ goodsData.supply_product_name }}</div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">适用区域</div>
        <div class="dl-dd">{{ goodsData.supply_address_code_name || '-' }}</div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">适用对象</div>
        <div class="dl-dd" v-html="formatLine(goodsData.load_entity)"></div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">担保额度</div>
        <div class="dl-dd">
          {{
            `${goodsData.load_amount_min || ''} -${goodsData.load_amount || ''}` | pureUnit('万元')
          }}
        </div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">融资期限</div>
        <div class="dl-dd">
          {{ `${goodsData.loan_term_min || ''} -${goodsData.loan_term || ''}` | pureUnit('月') }}
        </div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">担保费率</div>
        <div class="dl-dd">{{ goodsData.gua_rate || '' }}</div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">贷款利率</div>
        <div class="dl-dd">{{ goodsData.bank_rate || '' }}</div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">产品简介</div>
        <div class="dl-dd" v-html="formatLine(goodsData.des)"></div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">产品特点</div>
        <div class="dl-dd" v-html="formatLine(goodsData.features)"></div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">禁入条件</div>
        <div class="dl-dd" v-html="formatLine(goodsData.debar)"></div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">准入条件</div>
        <div class="dl-dd" v-html="formatLine(goodsData.access_cond)"></div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">反担保措施</div>
        <div class="dl-dd" v-html="formatLine(goodsData.risk_measure)"></div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">办理流程</div>
        <div class="dl-dd" v-html="formatLine(goodsData.process_des)"></div>
      </div>

      <div class="dl-wrap">
        <div class="dl-dt">资料清单</div>
        <div class="dl-dd" v-html="formatLine(goodsData.submit_list)"></div>
      </div>
      <div class="dl-wrap">
        <div class="dl-dt">联系电话</div>
        <div class="dl-dd">{{ goodsData.concat_number }}</div>
      </div>
    </div>
  </el-dialog>
</template>

<script>
// import {  enumRiskMethod } from '@/credit/plugins/enum'
// import { enumLoadProduct } from '@/credit/plugins/enum'
import { formatLine } from '@/common/plugins/tools/format'
import { enumChannelType } from '@/credit/views/city/program/NewProject'
import { enumProductType } from '@/credit/views/province/goods/goodsMixins'
export default {
  components: {},
  props: {
    visible: Boolean,
    goodsId: String,
  },
  data() {
    return {
      enumProductType,
      enumChannelType,
      formatLine,
      tableName: 'industrial_package',
      loading: false,
      goodsData: {},
    }
  },
  computed: {
    // goodsId() {
    //   return this.goodsData.industrial_package_id
    // },
  },
  watch: {
    visible: {
      handler: function () {
        if (this.visible) {
          this.getData()
        }
      },
      immediate: true,
    },
  },
  created() {},
  mounted() {},
  methods: {
    getData() {
      if (!this.goodsId) {
        this.goodsData = {}
        return
      }
      this.loading = true
      this.$api
        .getDataFromId(this.$serviceName, this.tableName, this.goodsId)
        .then(res => {
          this.goodsData = res?.data ?? {}
        })
        .finally(() => {
          this.loading = false
        })
    },
    beforeClose() {
      this.$emit('update:visible', false)
    },
  },
}
</script>

<style lang="scss" scoped></style>
